package javase_class_250908;

/**
 * ClassName: javase_class_250908.Outer1
 * Package: PACKAGE_NAME
 * Description:
 *
 * @Author harkjeans
 * @Create 2025/9/8 19:17
 * @Version 1.0
 */
public class Outer1 {
    private String outerField = "Outer Field";
    private static String staticOuterField = "Static Outer Field";

    // 静态嵌套类
    static class StaticNested {
        public void display() {
            // System.out.println(outerField); // 编译错误！不能访问非静态成员
            System.out.println("Accessing: " + staticOuterField); // 可以访问静态成员
            System.out.println("I am a static nested class.");
        }
    }
}

// 外部使用：不需要外部类实例
class Test1 {
    public static void main(String[] args) {
        // 语法：OuterClass.StaticNestedClass nestedObj = new OuterClass.StaticNestedClass();
        Outer1.StaticNested nested = new Outer1.StaticNested();
        nested.display();
    }
}
